package day2;

import java.io.*;

//缓冲流+新版的try-catch实现文件复制
public class TestCopy3 {
    public static void main(String[] args) {
        try(
                FileInputStream fis=new FileInputStream("d://io//target.txt");
                FileOutputStream fos=new FileOutputStream("d://io//movie//new2target.txt");
                BufferedInputStream bis=new BufferedInputStream(fis);
                BufferedOutputStream bos=new BufferedOutputStream(fos)
                ){
            byte[] bs=new byte[1024];
            int len=0;
            while((len= fis.read(bs))!=-1){
                bos.write(bs,0,len);
            }
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
